<template>
  <div class="margin-top">
    <el-table
        :data="pageData" stripe style="width: 100%"
        :header-cell-style="{
                'text-align':'center',
                'background-color':'#F0FFF0'
              }"
        :cell-style="{'text-align':'center'}">
      <el-table-column prop="id" label="序号"></el-table-column>
      <el-table-column prop="number" label="入库单号"/>
      <el-table-column prop="stockType" label="入库类型">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.in_type" :value="scope.row.stockType"/>
        </template>
      </el-table-column>
      <el-table-column prop="supplier" label="供应商名称">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.factory" :value="scope.row.supplier"/>
        </template>
      </el-table-column>>

      <el-table-column prop="tableMaker" label="制单人员"/>
      <el-table-column prop="purchaseSum" label="采购金额"/>
      <el-table-column prop="saleSum" label="零售金额"/>
      <el-table-column prop="stockWorker" label="入库人员"/>
      <el-table-column prop="createTime" label="创建时间" width="100"/>
      <el-table-column prop="checkStatus" label="审核状态">

        <template slot-scope="scope">
          <dict-tag :options="dict.type.audit_status" :value="scope.row.checkStatus"/>
        </template>

      </el-table-column>

      <el-table-column label="操作" width="180">
        <template slot-scope="scope">
          <el-link type="primary"
                   :underline="false"
                   @click="toOutStockPassCheck(scope.row.id)"
                   v-if="scope.row.checkStatus === 1 "

                   class="margin-right">查看
          </el-link>
          <el-link type="primary"
                   :underline="false"
                   @click="toOutStockNotPassCheck(scope.row.id)"
                   v-if="scope.row.checkStatus === 2 "
                   class="margin-right">查看
          </el-link>
          <el-link type="primary"
                   :underline="false"
                   @click="toOutStockNotCheck"
                   v-if="scope.row.checkStatus === 0  "
                   class="margin-right">编辑
          </el-link>
          <el-link type="primary"
                   :underline="false"
                   v-if="scope.row.checkStatus === 2 || scope.row.checkStatus === 0"
                   class="margin-right">删除
          </el-link>

        </template>
      </el-table-column>
    </el-table>
    <sn-page
        :table-data="tableData"
        class="float-right margin-top-20 margin-bottom-20"
        @getPageData="getPageData"/>
  </div>
</template>

<script>
import StockCheckWorkerInfo from "../../stocktaking/children/StockCheckWorkerInfo"

export default {
  dicts: ['sys_normal_disable','specification','drug_type','prescription_type','factory','drug_status','in_type','audit_status'],
  name: "EnterStockInfoTable",
  components: {
    StockCheckWorkerInfo
  },
  data() {
    return {
      //每页数据
      pageData: [],
    }
  },
  props: {
    //数据
    tableData: {
      type: Array,
      default() {
        return []
      }
    }
  },
  methods: {
    getPageData(pageData) {
      this.pageData = pageData
    },
    //查看审核通过
    toOutStockPassCheck(id) {
      this.$router.push('/yldrug/putstorage/putStorageYes/'+ id)
    },
    //查看审核未通过
    toOutStockNotPassCheck() {
      this.$router.push('/yldrug/putstorage/putStorageNo')
    },
    //编辑未审核
    toOutStockNotCheck() {
      this.$router.push('/yldrug/putstorage/editPutStorage')
    },
    //再次入库
    outStockAgain() {
      this.$router.push('/yldrug/putstorage/editPutStorage')
    }
  }
}
</script>

<style scoped>
</style>
